package zyc.service.impl;

import zyc.dao.UserDao;
import zyc.dao.impl.UserDaoimpl;
import zyc.pojo.User;
import zyc.service.UserService;

/**
 * @description:
 * @author: ZhaoYicong
 * @date: Created in 2020/7/16 7:30
 * @version: v1.0
 * @modified By:
 */
public class UserServiceImpl implements UserService {
    UserDao userDao=new UserDaoimpl();

    @Override
    public void registUser(User user) {
        userDao.saveUser(user);
    }

    @Override
    public User login(User user) {
        return userDao.queryUserByUsernameAndPassword(user.getUsername(), user.getPassword());

    }

    @Override
    public boolean exsitsUser(String username) {
        User user = userDao.qureUserByUsername(username);
        if (user==null){
            return false;
        }else{
            return true;
        }
    }
}
